#ifndef STUDENT_H
#define STUDENT_H

#include "size.h"
#include "status.h"

#define STUDENT_INIT_CAPCITY        5
#define STUDENT_INCREASE            5

#define STU_INSERT                  1   //插入学生信息(不包括成绩)
#define STU_CHANGE                  2   //修改学生信息(不包括成绩)

#define STU_IFIND                   1   //插入数据时,查找是否存在
#define STU_FIND                    2   //普通查找时，查找是否存在

#define STUACCOUNT_FLAG                 "101"

typedef struct Score{
    double mathScore;
    double chineseScore;
    double EnglishScore;
    double sum;
}Score;

typedef struct Student{
    char account[ACCOUNT_SIZE];
    char passwd[PASSWD_SIZE];
    int id;
    char name[NAME_SIZE];
    int age;
    Score score;
}Student;

typedef struct StuManage{
    Student* student;
    int numOfStu;
    int capcity;
}StuManage;

status StuInit(StuManage* stu);
status StuInsert(StuManage* stu,int i);
status StuInputMessage(StuManage* stu,int i,int insertOrChange);
status StuInputScore(StuManage* stu,int i);
status StuChangeMessageById(StuManage* stu,int id);
status StuChangeScoreById(StuManage* stu,int id);
status StuDelById(StuManage* stu,int id);
status StuSortById(StuManage* stu);
status StuSortByScore(StuManage* stu);
void StuShowScore(StuManage* stu,int start,int end);
status StuShowAllById(StuManage* stu,int id);
void StuShowAll(StuManage* stu);
status StuAccountIsExist(StuManage* stu,char* account,int* index,int ifindOrFind);

#endif